package model;

import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;

public class BreakablePlatform extends Platform
{
	
	private boolean broken = false;
	private double vy = -0.01; //TODO
	
	public BreakablePlatform(double cX, double cY) throws SlickException
	{
		super(cX, cY);
		image = new Image("data/zerbrechen.png");
	}
	
	public Type getType()
	{
		return Type.BRECHEN;
	}
	
	public void act()
	{
		if (super.misterJumpsOn())
		{
			broken = true;
		}
		if (broken)
		{
			setY(getY() + vy);
		}
		
	}
	
	public Image getImage()
	{
		Image img = super.getImage();
		if (!broken)
		{
			return img.getSubImage(0, 0, img.getWidth(), img.getHeight()/2);
		}
		else 
		{
			return img.getSubImage(0, img.getHeight()/2, img.getWidth(), img.getHeight()/2);
			/*
			Image img1 = img.getSubImage(0, img.getHeight()/2, img.getWidth()/2, img.getHeight()/2);
			Image img2 = img.getSubImage(img.getWidth()/2, img.getHeight()/2, img.getWidth()/2, img.getHeight()/2);
			
			img1.rotate(10);
			img2.rotate(-10);
			
			*/ 
		}
	}
	
	
	
	
}
